<template>
    <div class="forms clearfix">
        <el-input v-model.trim="val" @keyup.native.enter="search" placeholder="请输入想要的商品"></el-input>
        <el-button icon="el-icon-search" @click="search">搜索</el-button>
    </div>
</template>
<script>
export default {
    data() {
        return {
            val: ""
        };
    },
    methods: {
        search() {
            if (this.val == "") {
                this.$message({
                    type: "warning",
                    message: "搜索内容不能为空"
                });
            } else {
                this.$router.push("/search_list?word="+this.val);
            }
        }
    }
};
</script>
<style scoped>
.forms {
    width: 600px;
}
.forms >>> .el-input {
    width: 400px;
}
.forms >>> input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}
.forms >>> button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
</style>